#include <sys/time.h>
#include <time.h>
#include <stdio.h>
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>
#include "pnmio.h"
#include "klt.h"
#include "egluesh.h"
#include "egdebug.h"

long int timetable[MAX_TIME_TABLE_INDEX];

char timetablestr[MAX_TIME_TABLE_INDEX][MAXSTR] =
    {
        "FindFeatures",
        "GlueImage",
        "Sift1",
        "Sift2",
        "KdTree",
        "Ransac"
    };

void tic(struct timeval *t1)
{
	gettimeofday(t1,NULL);
}

long int tac(struct timeval t1)
{
	struct timeval t2;
	gettimeofday(&t2,NULL);
	return ((t2.tv_sec - t1.tv_sec)) * 1000 + (((double)t2.tv_usec - (double)t1.tv_usec) / (double)1000.0);
}

void showTimeTable()
{
    int i;
    for (i=0; i<MAX_TIME_TABLE_INDEX; i++)
    {
        fprintf(stderr,"%s = \t%ld\n",timetablestr[i],timetable[i]);
    }
}

void initTimeTable()
{
    int i;
    for (i=0; i<MAX_TIME_TABLE_INDEX; i++)
    {
        timetable[i] = 0;
    }
}
